package com.ruoyi.business.domain;

import com.alibaba.fastjson.JSON;
import com.ruoyi.business.dto.OpenPositionSemaphoreDto;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 交易参数设置对象 business_trade_config
 *
 * @author ruoyi
 * @date 2024-04-17
 */
@Data
@NoArgsConstructor
public class BusinessTradeConfig extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    private Long id;

    /**
     * 策略名称
     */
    @Excel(name = "策略名称")
    private String strategyName;

    /**
     * 策略说明
     */
    @Excel(name = "策略说明")
    private String strategyRemark;
    /**
     * 账户名称
     */
    @Excel(name = "账户名称")
    private String clientName;

    /**
     * 账户密码
     */
    private String password;

    /**
     * 策略组别id
     */
//    @Excel(name = "策略组别id")
    private Long strategyGroupId;

    /**
     * 策略组别名称
     */
    private String strategyGroupName;



    /** 股票代码 */
    @Excel(name = "股票标的")
    private String stockCode;

    /** 动态止盈率 %*/
    @Excel(name = "动态止盈价格回撤幅度(%)",width = 50)
    private BigDecimal dynamicStopProfitRate;

    /** 动态止损率  %*/
//    @Excel(name = "动态止损率")
    private BigDecimal dynamicStopLossRate;

    /** 静态止盈率 */
    @Excel(name = "静态止盈价格幅度(%)",width = 50)
    private BigDecimal staticStopProfitRate;

    /** 静态止盈率 */
    @Excel(name = "动态止盈价格幅度(%)",width = 50)
    private BigDecimal dynamicStopProfitBeforeRate;

    /** 静态止损率 */
    @Excel(name = "止损价格幅度(%)",width = 50)
    private BigDecimal staticStopLossRate;

    /** 日交易次数限额 */
    @Excel(name = "日开仓次数")
    private Long tradeTimesLimit;

    /** 日交易金额限额 */
    @Excel(name = "日交易总金额/万元",width = 50)
    private BigDecimal tradeAmountLimit;

    /** 单次交易股数限额 */
    @Excel(name = "单次交易股数限额",width = 50)
    private Long tradeVolumePerLimit;

    /** 单次交易金额限额 */
    @Excel(name = "开仓金额/万元",width = 50)
    private BigDecimal tradeAmountPerLimit;



    /** 是否开启对冲交易（0：否，1：是） */
    @Excel(name = "是否开启对冲交易", readConverterExp = "0=：否，1：是")
    private Boolean tradeHedge;

    /** 对冲交易做多金额 */
    @Excel(name = "对冲交易做多金额")
    private BigDecimal tradeHedgeSaleAmount;


    /** 对冲交易做空金额 */
    @Excel(name = "对冲交易做空金额")
    private BigDecimal tradeHedgeSellAmount;


    /** 对冲交易主单开仓金额 */
    @Excel(name = "对冲交易主单开仓金额")
    private BigDecimal tradeHedgeMainAmount;
    /** 对冲单开仓金额 */
    @Excel(name = "对冲单开仓金额")
    private BigDecimal  tradeHedgeAmount;


    /** 对冲交易做多动态止盈比率 */
    private BigDecimal tradeHedgeSaleDynamicProfitRate;


    /** 对冲交易做空动态止盈比率 */
    private BigDecimal tradeHedgeSellDynamicProfitRate;





    /**
     * 首次开仓委托类型: 0:普通买入 1：普通卖出
     */
    @Excel(name = "首次开仓方向",readConverterExp ="0=做多,1=做空" )
    private Integer firstPositionType;


    /**
     * 首次开仓延迟分钟数
     */
//    @Excel(name = "首次开仓延迟分钟数")
    private Integer positionDelayMinute;

    /**
     * 开仓策略（1：延迟开仓，2：百分比开仓 ，3：信号量开仓）
     */
//    @Excel(name = "开仓策略")
    private Integer openPositionStrategy;

    /** 开盘价上涨(下跌)百分比 */
    @Excel(name = "动态开仓价格幅度(%)",width = 50)
    private BigDecimal openPositionRate;


    /** 信号量开仓 */
//    @Excel(name = "信号量开仓")
    private OpenPositionSemaphoreDto openPositionSemaphore;

    //信号量开仓 json
    @Excel(name = "信号量数据")
    private String openPositionSemaphoreStr;


    /**
     * 策略状态: 0:启用 1：禁用
     */
//    @Excel(name = "策略状态: 0:启用 1：禁用 ")
    private Integer status;


    @Excel(name = "开仓时间", width = 30, dateFormat = "HH:mm:ss")
    private Date openPositionTime;

    @Excel(name = "平仓时间", width = 30, dateFormat = "HH:mm:ss")
    private Date closePositionTime;


    @Excel(name = "止盈类型")
    private String profitStopType;
}
